function list(pageNo,whereValue)
{
	var url = getAction()+"?cmd=data&"+serializeForm($("loginForm"));
	new Ajax.Request(url,{method:'post',	//支持中文
		onSuccess:function(transport){
		$("dataList").innerHTML = transport.responseText;
	}
	});
}

function getForm(){
return $("loginForm");
}

function getAction(){
	return "login.action";
}
//密码长度及合法性校验
function validatePwd()
{	//var passwordminLength=$("passwordminLength").value;
    //var passwordmaxLength=$("passwordmaxLength").value;
	var success = true;
	if(!checkBlank($("po.password"),"新密码"))
	{
		success = false;
	}else if(!legalValidate($("po.password").value))
	{
		success = false;
	}
	return success;
}

//用户密码必须同时包含大写字母、小写字母、数字和特殊字符四类要素中的三种，且不得与用户账号相同。
function legalValidate(str){
	var parentwindow = window.dialogArguments;
    var username = parentwindow.$("po.userName").value;
    
    var passwordminLength=$("passwordminLength").value;
    var passwordmaxLength=$("passwordmaxLength").value;
    var lengthflag=false;
    if($("po.password").value.length<passwordminLength || $("po.password").value.length>passwordmaxLength){
    	lengthflag=true;
    }
	var value = true;
	var item=0;
	var rule1=/[0-9]/;
	var rule2=/[a-z]/;
	var rule3=/[A-Z]/;
	var rule4=/\W|_/;
	if(rule1.test(str))
	   item=item+1;
    if(rule2.test(str))
       item=item+1;
    if(rule3.test(str))
       item=item+1;
    if(rule4.test(str))
        item=item+1;
	if(item<3 || lengthflag){
	    value=false;
	    alert("您的新密码字段必须长度必须大于等于"+passwordminLength+",小于等于"+passwordmaxLength+",且同时包含大写字母、小写字母、数字和特殊字符四类要素中的三种！");
	}else if(str==username)//else if(str==$("po.userName").value)
	{
	   value=false;
	   alert("密码不能与用户名相同！");
	}
	return value;
}

/**
 * 修改密码
 */
function modifyPW()
{   //alert("修改密码进来了");
	var parentwindow = window.dialogArguments;
    var username = parentwindow.$("po.userName").value;
    var old =parentwindow.$("po.password").value;
    //var username = $("po.userName").value;
    //var old = $("po.password").value;
    //alert("username="+username+"&old="+old);
	var oldPW = $("oldPW").value;
	var pw = $("po.password").value;
	var repw = $("repassword").value;
	
	if(old!=oldPW)
	{
		alert("原始密码不正确！");
		return;
	}else if(!validatePwd()){
		return;
	}else if(!(pw==repw))
	{
		alert("两次输入的密码不一致！");
		return;
	}
	
	var url ="validatelogin.action?cmd=update&po.userId="+$("po.userId").value+"&po.deptId="+$("po.deptId").value+"&po.password="+$("po.password").value+"&po.userName="+username;
    new Ajax.Request(url,{method: "post", onSuccess: function(transport) {
        $("userForm").reset();
        var retObj = transport.responseText.strip().replace(/&quot;/g, '"').evalJSON();
        alert(retObj.msg);
        if("1"==retObj.processId){
            var parentwindow = window.dialogArguments;
            parentwindow.$("mainfrm").action="validatelogin.action?formMap.type=pwdlogin";
            parentwindow.$("cmd").value="login";
            parentwindow.$("formMap.moduleId").value=204;
            parentwindow.$("po.userName").value=username;
            parentwindow.$("po.password").value=pw;
            parentwindow.$("mainfrm").submit();
            window.close();
        }
    }});
}

